Authorization API
Authorization Code Grant - Get Authorization Code
Request URL
GET /api/v1.0/invoke/open-ability/method/oauth2/auth
Request Parameter
| Parameter Name | Type | Location | Required | Description |
|---|---|---|---|---|
| scope | String | Query | Yes | Authorization scope, the value is user |
| state | String | Query | Yes | Client state |
| redirect_uri | String | Query | Yes | Redirect URI |
| response_type | String | Query | Yes | Response type, the value is code |
| client_id | String | Query | Yes | Client ID |
Return Parameter
| Parameter Name | Type | Location | Description |
|---|---|---|---|
| state | String | Query | Client state, consistent with the input parameter |
| code | String | Query | Authorization code |
Request Example
GET /api/v1.0/invoke/open-ability/method/oauth2/auth?scope=user&state=1&response_type=code&client_id=caa0b4dffd57202a157bf46664f93c192&redirect_uri=https://demo.akubela.com

Success Return Example
https://demo.akubela.com?state=1&code=cb66a21f7d9fe1a141676a563c5a7eacf

Failure Return Example
Null

Authorization Code Grant - Get Access Token
Request URL
POST /api/v1.0/invoke/open-ability/method/oauth2/token
Request Parameter
| Parameter Name | Type | Location | Required | Description |
|---|---|---|---|---|
| Content-Type | String | Header | Yes | Content type, the value is application/x-www-form-urlencoded |
| Accept | String | Header | Yes | Accept, the value is application/json |
| grant_type | String | Body | Yes | Grant type, the value is authorization_code |
| code | String | Body | Yes | Authorization code |
| client_id | String | Body | Yes | Client ID |
| client_secret | String | Body | Yes | Client secret |
| redirect_uri | String | Body | Yes | Redirect URI |
| expires_in | Integer | Body | No | Token expiration time (s) |
Return Parameter
| Parameter Name | Type | Location | Description |
|---|---|---|---|
| Content-Type | String | Header | Content type, the value is application/json |
| success | Boolean | Body | Whether the request is successful or not? true: success false: failure |
| timestamp | Integer | Body | Timestamp |
| result | Object<result> | Body | Return result |
result description
| Parameter Name | Type | Location | Description |
|---|---|---|---|
| access_token | String | Body | Access token |
| refresh_token | String | Body | Refresh token |
| token_type | String | Body | Token type, the value is bearer |
| expires_in | Integer | Body | Token expiration time (s) |
Request Example
POST /api/v1.0/invoke/open-ability/method/oauth2/token
Content-Type: application/x-www-form-urlencoded
Accept: application/json
grant_type=authorization_code&
code=cb66a21f7d9fe1a141676a563c5a7eacf&
client_id=caa0b4dffd57202a157bf46664f93c192&
client_secret=s75b058bfd9e4e0659d75b67a03334745&
redirect_uri=https://demo.akubela.com
Success Return Example
Status Code: 200
Content-Type: application/json
{
"success": true,
"timestamp": 1540869200562,
"result": {
"access_token": "ad5db2a3d3ab09e5890c4ffba9eaf3c55",
"refresh_token": "r91b9ba8bc024e23617f63f908dc15950",
"token_type": "bearer",
"expires_in": 3600
}
}
Failure Return Example
Password Grant - Get Access Token
Request URL
POST /api/v1.0/invoke/open-ability/method/oauth2/token
Request Parameter
| Parameter Name | Type | Location | Required | Description |
|---|---|---|---|---|
| Content-Type | String | Header | Yes | Content type, the value is application/x-www-form-urlencoded |
| Accept | String | Header | Yes | Accept, the value is application/json |
| grant_type | String | Body | Yes | Grant type, the value is password |
| client_id | String | Body | Yes | Client ID |
| client_secret | String | Body | Yes | Client secret |
| scope | String | Body | Yes | Authorization scope, the value is user |
| username | String | Body | Yes | Username |
| password | String | Body | Yes | Password |
| expires_in | Integer | Body | No | Token expiration time (s) |
Return Parameter
| Parameter Name | Type | Location | Description |
|---|---|---|---|
| Content-Type | String | Header | Content type, the value is application/json |
| success | Boolean | Body | Whether the request is successful or not? true: success false: failure |
| timestamp | Integer | Body | Timestamp |
| result | Object<result> | Body | Return result |
result description
| Parameter Name | Type | Location | Description |
|---|---|---|---|
| access_token | String | Body | Access token |
| refresh_token | String | Body | Refresh token |
| token_type | String | Body | Token type, the value is bearer |
| expires_in | Integer | Body | Token expiration time (s) |
Request Example
POST /api/v1.0/invoke/open-ability/method/oauth2/token
Content-Type: application/x-www-form-urlencoded
Accept: application/json
grant_type=password&
client_id=caa0b4dffd57202a157bf46664f93c192&
client_secret=s75b058bfd9e4e0659d75b67a03334745&
username=ucaa0b4dffd57202a157bf46664f93c19&
password=pucaa0b4dffd57202a157bf46664f93c1&
scope=user
Success Return Example
Status Code: 200
Content-Type: application/json
{
"success": true,
"timestamp": 1540869200562,
"result": {
"access_token": "ad5db2a3d3ab09e5890c4ffba9eaf3c55",
"refresh_token": "r91b9ba8bc024e23617f63f908dc15950",
"token_type": "bearer",
"expires_in": 3600
}
}
Failure Return Example
Refresh Access Token
Request URL
POST /api/v1.0/invoke/open-ability/method/oauth2/token
Request Parameter
| Parameter Name | Type | Location | Required | Description |
|---|---|---|---|---|
| Content-Type | String | Header | Yes | Content type, the value is application/x-www-form-urlencoded |
| Accept | String | Header | Yes | Accept, the value is application/json |
| grant_type | String | Body | Yes | Authorization type, the value is refresh_token |
| client_id | String | Body | Yes | Client ID |
| client_secret | String | Body | Yes | Client secret |
| refresh_token | String | Body | Yes | Refresh token |
| expires_in | Integer | Body | No | Token expiration time (s) |
Return Parameter
| Parameter Name | Type | Location | Description |
|---|---|---|---|
| Content-Type | String | Header | Content type, the value is application/json |
| success | Boolean | Body | Whether the request is successful or not? true: success false: failure |
| timestamp | Integer | Body | Timestamp |
| result | Object<result> | Body | Return result |
result description
| Parameter Name | Type | Location | Description |
|---|---|---|---|
| access_token | String | Body | Access token |
| refresh_token | String | Body | Refresh token |
| token_type | String | Body | Token type, the value is bearer |
| expires_in | Integer | Body | Token expiration time (s) |
Request Example
POST /api/v1.0/invoke/open-ability/method/oauth2/token
Content-Type: application/x-www-form-urlencoded
Accept: application/json
grant_type=refresh_token&
client_id=caa0b4dffd57202a157bf46664f93c192&
client_secret=s75b058bfd9e4e0659d75b67a03334745&
refresh_token=r91b9ba8bc024e23617f63f908dc15950
Success Return Example
Status Code: 200
Content-Type: application/json
{
"success": true,
"timestamp": 1540869200562,
"result": {
"access_token": "ad5db2a3d3ab09e5890c4ffba9eaf3c53",
"refresh_token": "r91b9ba8bc024e23617f63f908dc15952",
"token_type": "bearer",
"expires_in": 3600
}
}